/*
********************************************************************************
* Copyright (C) 2022, xiang.D <dx_65535@163.com>.
* All right reserved.
*
* File Name   : visitor_driver.cc
* Author      :
* Version     : V1.0
* Description :
* Journal     : 2022-03-06 version v1.0
* Brief       : Blog: https://blog.csdn.net/qq_38750572?spm=1001.2014.3001.5343
* Others      :
                Compile command: make
********************************************************************************
*/

#include "visitor_driver.h"
#include "part_gpu.h"
#include "part_sound_card.h"

#define DRV_LOGE(fmt, args...) printf("%d VisitorDriver E: " fmt, __LINE__, ##args)
#define DRV_LOG(fmt, args...)  printf(fmt, ##args)

CVisitorDriver::CVisitorDriver()
    : mName("Driver")
{

}

CVisitorDriver::~CVisitorDriver()
{

}

std::string CVisitorDriver::GetName()
{
    return mName;
}

int CVisitorDriver::VisitGpu(CPartGpu *gpu)
{
    if (gpu->CheckDriver() <= 0) {
        DRV_LOG("%s of Gpu Failed!\n", this->GetName().c_str());
    } else {
        DRV_LOG("%s of Gpu Success!\n", this->GetName().c_str());
    }        
    
    return 0;
}

int CVisitorDriver::VisitSoundCard(CPartSoundCard *soundCard)
{
    if (NULL == soundCard) {
        DRV_LOGE("soundCard is NULL!\n");
    }

    if (soundCard->CheckDriver() <= 0) {
        DRV_LOG("%s of SoundCard Failed!\n", this->GetName().c_str());
    } else {
        DRV_LOG("%s of SoundCard Success!\n", this->GetName().c_str());
    }

    return 0;
}

